package hp.com.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import hp.com.entity.Car;
import hp.com.entity.Manager;
import hp.com.entity.Order;
import hp.com.entity.User;
import hp.com.mapper.ManagerMapper;

@Service
public class ManagerServiceImpl implements ManagerService {
	@Autowired
	private ManagerMapper managerMapper;

	//登陆
	public Manager login(Manager manager) {
		Manager m = managerMapper.login(manager);
		return m;
	}
	//查询所有汽车信息
		public List<Car> carSelAll() {
			List<Car> clist=managerMapper.carSelAll();
			return clist;
		}
		//添加汽车信息
		public int carAdd(Car car) {
			int a=managerMapper.carAdd(car);
			return a;
		}
		//删除汽车信息
		public int delCarById(int cid) {
			int a=managerMapper.delCarById(cid);
			return a;
		}
		//查询回显
		@Override
		public Car selcarById(int cid) {
			Car car = managerMapper.selcarById(cid);
			return car;
		}
		//修改汽车信息
		@Override
		public int carUpd(Car car) {
			int i = managerMapper.carUpd(car);
			return i;
		}
		//查询所有管理员信息
		@Override
		public List<Manager> managerSelAll() {
			List<Manager> list = managerMapper.managerSelAll();
			return list;
		}
		//添加管理员信息
		@Override
		public int managerAdd(Manager manager) {
			int i = managerMapper.managerAdd(manager);
			return i;
		}
		//删除管理员信息
		@Override
		public int delmanagerById(int id) {
			int i = managerMapper.delmanagerById(id);
			return i;
		}
		//查询所有汽车信息
		@Override
		public List<User> userSelAll() {
			List<User> list = managerMapper.userSelAll();
			return list;
		}
		//添加用户信息
		@Override
		public int userAdd(User user) {
			int i = managerMapper.userAdd(user);
			return i;
		}
		//删除用户
		@Override
		public int deluserById(int id) {
			int i = managerMapper.deluserById(id);
			return i;
		}
		//查询用户订单信息
		@Override
		public List<Order> selorderById(int uid) {
			List<Order> list = managerMapper.selorderById(uid);
			return list;
		}
		//查询所有的订单信息
		@Override
		public List<Order> orderSelAll() {
			List<Order> list = managerMapper.orderSelAll();
			return list;
		}
		//通过id查询管理员
		public Manager gselcarById(int mid) {
			Manager manager = managerMapper.gselcarById(mid);
			return manager;
		}
		//同id修改管理员
		public int gupdate(Manager manager) {
			int a = managerMapper.gupdate(manager);
			return a;
		}
}
